const hardPlugin = require('hard-source-webpack-plugin')
const { resolve } = require('path')

module.exports = {
    css: {
        loaderOptions: {
            less: {
                lessOptions: {
                    javascriptEnabled: true,
                },
            },
        },
    },
    publicPath: '/',
    configureWebpack: {
        plugins: [
            new hardPlugin({
                cacheDirectory: resolve(__dirname, 'cache'),
                test: /mini-css-extract-plugin[\\/]dist[\\/]loader/
            })
        ],
        resolve: {
            alias: {
                '@a': resolve(__dirname, 'src/assets'),
                '@c': resolve(__dirname, 'src/components'),
                '@co': resolve(__dirname, 'src/commons'),
                '@u': resolve(__dirname, 'src/use'),
                '@r': resolve(__dirname, 'src/router'),
                '@v': resolve(__dirname, 'src/views'),
                '@vp': resolve(__dirname, 'src/view-provider'),
                '@p': resolve(__dirname, 'src/plugins'),
                '@b': resolve(__dirname, 'src/blocks'),
                '@s': resolve(__dirname, 'src/static'),
            }
        },
        /* module: { //这个节点用于配置所有的第三方模块加载器
             rules: [
                 { test: /\.css$/, use: ['style-loader', 'css-loader'] },//配置处理.css文件的第三方处理规则
                 { test: /\.less$/, use: ["style-loader", 'css-loader', 'less-loader'] },
                 { test: /\.scss$/, use: ["style-loader", 'css-loader', 'sass-loader'] },
                 { test: /\.(jpg|png|gif|bmp|jpeg)$/, use: "url-loader?limit=8000" },
                 { test: /\.(tff|eot|svg|woff|woff2)$/, use: "url-loader" },
                 { test: /\.js$/, use: 'babel-loader', exclude: /node_modules/ },
                 { test: /\.vue$/, use: 'vue-loader' }
             ]
         }
         */

    }
}